package vn.game;

import java.util.ArrayList;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class CrossWordDbAdapter {

	private String tag = CrossWordDbAdapter.class.getSimpleName();
	private DatabaseHelper mDbHelper;
	private SQLiteDatabase mDb;

	private final Context mCtx;

	// SQL statement!
	private static final String DATABASE_CREATE_TABLE_CROSSWORD = "CREATE TABLE " + clsContant.TBL_CROSSWORD
			+ " ( _id INTEGER PRIMARY KEY autoincrement, NAME text, KIND text, ROW int not null, COL int not null, PLAYED int );";

	private static final String DATABASE_CREATE_TABLE_DETAIL = "CREATE TABLE  " + clsContant.TBL_DETAIL
			+ "  (  _id INTEGER PRIMARY KEY , NUM int not null, GAMEID int not null"
			+ ", POSITION int not null, ACROSS boolean not null, WORD text not null,  HINT text not null);";

	private static final String DATABASE_CREARE_TRIGGER_DELETE_A_GAME = "CREATE TRIGGER IF NOT EXISTS Trigger_DeleteAgame BEFORE DELETE ON "
			+ clsContant.TBL_CROSSWORD + " FOR EACH ROW BEGIN DELETE FROM " + clsContant.TBL_DETAIL + " WHERE GAMEID = OLD._id; END;";

	private static final String DATABASE_CREATE_TRIGGER_INSERT_A_GAME_DETAIL = "CREATE TRIGGER IF NOT EXISTS Trigger_InsetAGameDetail BEFORE INSERT ON "
			+ clsContant.TBL_DETAIL
			+ " FOR EACH ROW BEGIN SELECT CASE WHEN ((SELECT _id FROM "
			+ clsContant.TBL_CROSSWORD
			+ " WHERE _id = NEW.GAMEID ) IS NULL) THEN RAISE (ABORT,'Foreign Key Violation') END; END;";

	private static class DatabaseHelper extends SQLiteOpenHelper {

		public DatabaseHelper(Context context) {
			super(context, clsContant.DATABASE_NAME, null, clsContant.DATABASE_VERSION);
		}

		@Override
		public void onCreate(SQLiteDatabase db) {
			// TODO Auto-generated method stub
			db.execSQL(DATABASE_CREATE_TABLE_CROSSWORD);
			db.execSQL(DATABASE_CREATE_TABLE_DETAIL);
			db.execSQL(DATABASE_CREATE_TRIGGER_INSERT_A_GAME_DETAIL);
			db.execSQL(DATABASE_CREARE_TRIGGER_DELETE_A_GAME);
		}

		@Override
		public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
			// TODO Auto-generated method stub

		}
	}

	public CrossWordDbAdapter open() throws SQLException {
		mDbHelper = new DatabaseHelper(mCtx);
		mDb = mDbHelper.getWritableDatabase();
		insertDataTest();
		return this;
	}

	public void close() {
		mDbHelper.close();
		Log.i(tag, "DB close");
	}

	public CrossWordDbAdapter(Context context) {
		mCtx = context;
	}

	public Cursor getAllCrossword() {
		return mDb.query(clsContant.TBL_CROSSWORD, new String[] { clsContant.colKind, "_id" }, null, null, null, null, null);
	}

	public Cursor getAllDetail() {
		return mDb.query(clsContant.TBL_DETAIL, new String[] { clsContant.colNum, clsContant.colGameID, clsContant.colPostion, clsContant.colAcross,
				clsContant.colWord, clsContant.colHint }, null, null, null, null, null);
	}

	public Cursor getGame(int id) {
		Cursor cur = null;
		try {
			cur = mDb.query(clsContant.TBL_CROSSWORD, new String[] { clsContant.colRow, clsContant.colCol, clsContant.colName, clsContant.colKind,
					clsContant.colPlayed }, " _id= " + id, null, null, null, null);
		} catch (Exception ex) {
			Log.i(tag, "getGame id:" + id + " Error:" + ex);
		}
		return cur;
	}

	public Cursor getGame() {
		Cursor cur = null;
		try {
			cur = mDb.query(clsContant.TBL_CROSSWORD, new String[] { "_id", clsContant.colRow, clsContant.colCol }, clsContant.colPlayed + " = 0 ",
					null, null, null, null);
		} catch (Exception ex) {
			Log.i(tag, "getGame() Error:" + ex);
		}
		return cur;
	}

	public Cursor getNameCrosswordByKind(String name) {
		return mDb.query(clsContant.TBL_CROSSWORD, new String[] { clsContant.colName, "_id", clsContant.colRow, clsContant.colCol,
				clsContant.colPlayed }, clsContant.colKind + " = '" + name + "'", null, null, null, null);
	}

	public Cursor GetDetail(long id) {
		try {
			String[] params = new String[] { String.valueOf(id) };
			Cursor cur = mDb.rawQuery("SELECT " + clsContant.colGameID + "," + clsContant.colNum + "," + clsContant.colAcross + ","
					+ clsContant.colPostion + "," + clsContant.colWord + "," + clsContant.colHint + " FROM " + clsContant.TBL_DETAIL + " WHERE "
					+ clsContant.colGameID + "=? Order by " + clsContant.colNum, params);

			return cur;
		} catch (Exception ex) {
			Log.e(tag, "GetDetail() Error: " + ex.getMessage());
			return null;
		}
	}

	public long insertNewCrossword(String name, String kind, int row, int col, int played) {
		ContentValues insertedValue = new ContentValues();
		insertedValue.put(clsContant.colName, name);
		insertedValue.put(clsContant.colKind, kind);
		insertedValue.put(clsContant.colRow, row);
		insertedValue.put(clsContant.colCol, col);
		insertedValue.put(clsContant.colPlayed, played);

		return mDb.insert(clsContant.TBL_CROSSWORD, null, insertedValue);
	}

	public long insertNewDetail(int num, int gameid, int position, boolean across, String word, String hint) {
		ContentValues insertedValue = new ContentValues();
		insertedValue.put(clsContant.colNum, num);
		insertedValue.put(clsContant.colGameID, gameid);
		insertedValue.put(clsContant.colPostion, position);
		insertedValue.put(clsContant.colAcross, across);
		insertedValue.put(clsContant.colWord, word);
		insertedValue.put(clsContant.colHint, hint);

		return mDb.insert(clsContant.TBL_DETAIL, null, insertedValue);
	}

	public Cursor getKeyIdByName(String name) {
		return mDb.query(clsContant.TBL_CROSSWORD, new String[] { "_id", clsContant.colRow, clsContant.colCol }, clsContant.colName + "= '" + name
				+ "'", null, null, null, null);
	}

	public boolean deleteAdetail(long gameId) {

		return mDb.delete(clsContant.TBL_DETAIL, clsContant.colGameID + "=" + gameId, null) > 0;
	}

	public boolean deleteAgame(long gameId) {
		try {
			mDb.execSQL(DATABASE_CREARE_TRIGGER_DELETE_A_GAME);
			return mDb.delete(clsContant.TBL_CROSSWORD, "_id = " + gameId, null) > 0;
		} catch (Exception ex) {
			Log.e(tag + ".deleteAgame", "Error: " + ex.getMessage());
			return false;
		}
	}

	public long insertGame(clsWord data) {
		try {
			ContentValues cv = new ContentValues();

			// cv.put(clsContant.colName, data.getName());
			// cv.put(clsContant.colKind, data.getKind());
			cv.put(clsContant.colRow, data.getRow());
			cv.put(clsContant.colCol, data.getColumn());
			cv.put(clsContant.colPlayed, 0);
			return mDb.insert(clsContant.TBL_CROSSWORD, null, cv);
		} catch (Exception ex) {
			Log.i(tag + ".insertGame", "Error: " + ex.getMessage());
			return -1;
		}
	}

	public boolean updateGame(clsWord data) {
		try {
			ContentValues cv = new ContentValues();

			cv.put(clsContant.colName, data.getName());
			cv.put(clsContant.colKind, data.getKind());
			cv.put(clsContant.colRow, data.getRow());
			cv.put(clsContant.colCol, data.getColumn());
			cv.put(clsContant.colPlayed, data.getPlayed());
			mDb.update(clsContant.TBL_CROSSWORD, cv, "_id=?", new String[] { String.valueOf(data.getId()) });

			return true;
		} catch (Exception ex) {
			Log.i(tag + ".updateGame", "Error: " + ex.getMessage());
			return false;
		}

	}

	public boolean updateGame(int id, int played) {
		try {
			ContentValues cv = new ContentValues();

			cv.put(clsContant.colId, id);
			cv.put(clsContant.colPlayed, played);
			mDb.update(clsContant.TBL_CROSSWORD, cv, clsContant.colId + "=?", new String[] { String.valueOf(id) });

			return true;
		} catch (Exception ex) {
			Log.i(tag, "updateGame() Error: " + ex.getMessage());
			return false;
		}

	}

	public long insertDetail(long gameId, clsWordDetail data) {
		try {
			ContentValues cv = new ContentValues();
			cv.put(clsContant.colGameID, gameId);
			cv.put(clsContant.colNum, data.getNum());
			cv.put(clsContant.colWord, data.getWords());
			cv.put(clsContant.colPostion, data.getPos());
			cv.put(clsContant.colAcross, data.isAcross());
			cv.put(clsContant.colHint, data.getHint());
			return mDb.insert(clsContant.TBL_DETAIL, null, cv);
		} catch (Exception ex) {
			Log.i(tag + "insertDetail", "Error: " + ex.getMessage());
			return -1;
		}
	}

	public long insertDetail(long gameId, ArrayList<clsWordDetail> arrL) {
		try {
			ContentValues cv = new ContentValues();
			for (clsWordDetail data : arrL) {
				cv.put(clsContant.colGameID, gameId);
				cv.put(clsContant.colNum, data.getNum());
				cv.put(clsContant.colWord, data.getWords());
				cv.put(clsContant.colPostion, data.getPos());
				cv.put(clsContant.colAcross, data.isAcross());
				cv.put(clsContant.colHint, data.getHint());
				mDb.insert(clsContant.TBL_DETAIL, null, cv);
			}
			return 1;
		} catch (Exception ex) {
			Log.i(tag + "insertDetail", "Error: " + ex.getMessage());
			return -1;
		}
	}

	public void insertDataTest() {
		int id;
		clsWord data;
		clsWordDetail detail;
		Cursor cur = null;
		try {
			cur = mDb.rawQuery("SELECT count(*) FROM " + clsContant.TBL_CROSSWORD, null);
			if (cur != null) {
				cur.moveToFirst();
				Log.i(tag, "Total game: " + cur.getInt(0));
				if (cur.getInt(0) <= 0) {
					data = new clsWord();
					data.setAll(14, 14, "Game1", "Other");
					id = (int) insertGame(data);
					Log.i(tag, "1 insert game id:" + id);
					if (id >= 0) {
						detail = new clsWordDetail();
						// int id, int num, boolean across,int pos, String words, String hint
						detail.setAll(id, 1, false, 71, "TROMBONE", "What is a skeleton's favorite instrument? A ____.");
						insertDetail(id, detail);
						detail.setAll(id, 2, true, 127, "BLOODHOUNDS", "What type of dog do vampires");
						insertDetail(id, detail);
						detail.setAll(id, 3, false, 115, "GORE", "Why are vampires Democrats? Thay want ____ in 2000!");
						insertDetail(id, detail);
						detail.setAll(id, 4, true, 87, "PUPIL", "Why did the cyclops quit teaching? He had only one ___.");
						insertDetail(id, detail);
						detail.setAll(id, 5, true, 45, "TOMBSTONES", "What kind of rocks does Frankenstein have in his collection?");
						insertDetail(id, detail);
						detail.setAll(id, 6, false, 32, "BOO", "How does a ghost cry? ____Hoo!");
						insertDetail(id, detail);
						detail.setAll(id, 7, true, 19, "HUNGRY", "What do you call a monster chasing a train full of people?");
						insertDetail(id, detail);
						detail.setAll(id, 8, false, 10, "DYING", "Why are there fences around cemeteries? Because people are ____ to get in.");
						insertDetail(id, detail);
						detail.setAll(id, 9, false, 12, "FROSTBITE", "What do you get when you cross a vampire with a snowman?");
						insertDetail(id, detail);
						detail.setAll(id, 10, true, 95, "DIG", "Who did the Zombie invite to his party? Anybody he could ____up.");
						insertDetail(id, detail);
						detail.setAll(id, 11, false, 152, "NECK", "What's it like to be kissed by a vampire? It's a pain in the ____");
						insertDetail(id, detail);
						detail.setAll(id, 12, false, 49, "SKELETON", "What kind of key shound you always take to a haunted house?");
						insertDetail(id, detail);
						detail.setAll(id, 13, true, 162, "SCARE", "What do witches put in their hair? ____Spray.");
						insertDetail(id, detail);
						detail.setAll(id, 14, false, 136, "DEAD", "What kind of street to zombies like? ____ends.");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(14, 14, "Game2", "Other");
					id = (int) insertGame(data);
					Log.i(tag, "2 insert game id:" + id);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll(id, 1, false, 3, "SHEET",
								"what did the daddy ghost say to his family when they went out for a drive? Fasten your ____belts.");
						insertDetail(id, detail);
						detail.setAll(id, 2, false, 19, "SLIME", "What is ghouls favorite drink? ____juice.");
						insertDetail(id, detail);
						detail.setAll(id, 3, false, 11, "STAKE", "What does a vampire never order at a restaurant? A____ Sandwich.");
						insertDetail(id, detail);
						detail.setAll(id, 4, true, 85, "WRAP", "What kind of music do mummies listen to?");
						insertDetail(id, detail);
						detail.setAll(id, 6, true, 35, "SCREAM", "What does a ghost have for desert? I-____.");
						insertDetail(id, detail);
						detail.setAll(id, 7, true, 107, "AHEAD",
								"Why did the headless horsemen go into business for himself? He wanted to get ____ in life?");
						insertDetail(id, detail);
						detail.setAll(id, 9, true, 59, "TOMBSTONES", "What kind of rocks does Frankenstein have in his collection?");
						insertDetail(id, detail);
						detail.setAll(id, 13, false, 63, "SQUASH", "What do you get then you drop a pumpkin?");
						insertDetail(id, detail);
						detail.setAll(id, 10, false, 72, "TROMBONE", "What is a skeleton's favorite instrument? A____.");
						insertDetail(id, detail);
						detail.setAll(id, 11, true, 128, "BLOODHOUNDS", "What type of dog do vampires like best?");
						insertDetail(id, detail);
						detail.setAll(id, 12, true, 156, "NECK", "what's it like to be kissed by a vampire? It's a pain in the ____.");
						insertDetail(id, detail);
						detail.setAll(id, 14, false, 138, "SPOOK",
								"What did the mommy ghost say to the baby ghost? Don't ____until you're spooken to.");
						insertDetail(id, detail);
						detail.setAll(id, 15, false, 93, "VACUUM", "Why do witches use brooms to fly on? Because ____ cleaners are too heavy.");
						insertDetail(id, detail);
						detail.setAll(id, 8, true, 165, "BOO", "How does a ghost cry? ___Hoo");
						insertDetail(id, detail);
						detail.setAll(id, 5, true, 190, "PUMPKIN", "How did the ghost patch his sheet? With a ____ patch.");
						insertDetail(id, detail);
					}

					//

					data = new clsWord();
					data.setAll(13, 14, "Game4", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll(id, 1, true, 1, "MARS", "Red Planet?");
						insertDetail(id, detail);
						detail.setAll(id, 2, false, 4, "SONNET", "A poem of 14 lines?");
						insertDetail(id, detail);
						detail.setAll(id, 3, true, 43, "DRONE", "Male bee is called?");
						insertDetail(id, detail);
						detail.setAll(id, 4, true, 71, "PRATHIBHAPATIL", "Who is the first woman president of India?");
						insertDetail(id, detail);
						detail.setAll(id, 5, true, 20, "JODHPUR", "Sun city of India?");
						insertDetail(id, detail);
						detail.setAll(id, 6, false, 12, "GRAVITY", "Earth has a force of 9.8m/s2 called?");
						insertDetail(id, detail);
						detail.setAll(id, 7, false, 14, "BRAZIL", "Contry famous for Samba dance?");
						insertDetail(id, detail);
						detail.setAll(id, 8, false, 49, "COBRA", "Deadliest snake?");
						insertDetail(id, detail);
						detail.setAll(id, 9, false, 52, "CAPETOWN", "Legislative capital of South Africa?");
						insertDetail(id, detail);
						detail.setAll(id, 10, true, 122, "OZONE", "Layer that protects earth from ultra violet");
						insertDetail(id, detail);
						detail.setAll(id, 11, false, 72, "RUGBY", "The sport in which the ball is in egg shape?");
						insertDetail(id, detail);
						detail.setAll(id, 12, true, 114, "BURMA", "Old name of Myanmar?");
						insertDetail(id, detail);
						detail.setAll(id, 13, false, 102, "GREEN", "Color of the gem called Emerald?");
						insertDetail(id, detail);
						detail.setAll(id, 14, false, 118, "ANDES", "Americas highest mountain range?");
						insertDetail(id, detail);
						detail.setAll(id, 15, true, 156, "SUN", "Nearest star?");
						insertDetail(id, detail);
						detail.setAll(id, 16, false, 120, "DOLLY", "Name of the first cloned sheep");
						insertDetail(id, detail);
						detail.setAll(id, 17, true, 148, "LONDON", "The Heathrow airport is located in?");
						insertDetail(id, detail);
						detail.setAll(id, 18, true, 176, "YANKEE", "Nickname of American?");
						insertDetail(id, detail);

					}

					data = new clsWord();
					data.setAll(13, 13, "Game5", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();

						detail.setAll1(1, id, 1, true, "COMIC", "Children's paper.");
						insertDetail(id, detail);
						detail.setAll1(14, id, 3, false, "MOTIF", "Recurring design.");
						insertDetail(id, detail);
						detail.setAll1(15, id, 5, false, "CAMEL", "Ship of the desert?");
						insertDetail(id, detail);
						detail.setAll1(16, id, 7, false, "CARROT", "A deep orange vegetable.");
						insertDetail(id, detail);
						detail.setAll1(2, id, 9, true, "MOPED", "Motorized cycle.");
						insertDetail(id, detail);
						detail.setAll1(17, id, 11, false, "PAL", "A friend.");
						insertDetail(id, detail);
						detail.setAll1(18, id, 13, false, "DONOR", "A giver.");
						insertDetail(id, detail);
						detail.setAll1(3, id, 20, true, "APE", "Mimic.");
						insertDetail(id, detail);
						detail.setAll1(4, id, 27, true, "BAT", "Noctunal mammal.");
						insertDetail(id, detail);
						detail.setAll1(5, id, 31, true, "MAR", "Spoil.");
						insertDetail(id, detail);
						detail.setAll1(6, id, 35, true, "TALON", "Bird of prey's claw.");
						insertDetail(id, detail);
						detail.setAll1(7, id, 53, true, "AWFUL", "Terrible.");
						insertDetail(id, detail);
						detail.setAll1(19, id, 54, false, "WEB", "A spider's trap.");
						insertDetail(id, detail);
						detail.setAll1(8, id, 61, true, "ROWER", "Oarsman.");
						insertDetail(id, detail);
						detail.setAll1(20, id, 63, false, "WAX", "Secretion of the ear.");
						insertDetail(id, detail);
						detail.setAll1(9, id, 79, true, "ABSORB", "Soak up.");
						insertDetail(id, detail);
						detail.setAll1(21, id, 81, false, "SUB", "Beneath.");
						insertDetail(id, detail);
						detail.setAll1(10, id, 86, true, "HOAXER", "Deceiver.");
						insertDetail(id, detail);
						detail.setAll1(22, id, 90, false, "EEL", "Snakelike fish.");
						insertDetail(id, detail);
						detail.setAll1(23, id, 98, false, "ANGELS", "Celestial beings.");
						insertDetail(id, detail);
						detail.setAll1(24, id, 105, false, "CANAL", "Man made waterway.");
						insertDetail(id, detail);
						detail.setAll1(25, id, 109, false, "NANNY", "A children's nurse.");
						insertDetail(id, detail);
						detail.setAll1(26, id, 133, false, "LEU", "Currency of Romania.");
						insertDetail(id, detail);
						detail.setAll1(11, id, 148, true, "NIL", "Zero.");
						insertDetail(id, detail);
						detail.setAll1(12, id, 157, true, "LOUSY", "Infested with Lice.");
						insertDetail(id, detail);
						detail.setAll1(13, id, 165, true, "RERUN", "To broadcast again.");
						insertDetail(id, detail);
						detail.setAll1(27, id, 117, false, "EATEN", "Consumed food.");
						insertDetail(id, detail);
						detail.setAll1(28, id, 101, false, "URGLY", "antonym with cute.");
						insertDetail(id, detail);

					}

					data = new clsWord();
					data.setAll(13, 13, "Game6", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll1(6, id, 13, false, "GORE", "Why are vampires Democrats? They want ___ in 2000!");
						insertDetail(id, detail);
						detail.setAll1(1, id, 18, true, "SHEET",
								"What did the daddy ghost say to his family when they went out for a drive? Fasten your ___ belts.");
						insertDetail(id, detail);
						detail.setAll1(7, id, 22, false, "TOMBSTONES", "What kind of rocks does Frankenstein have in his collection?");
						insertDetail(id, detail);
						detail.setAll1(8, id, 30, false, "SKELETON", "What kind of key should you always take to a haunted house?");
						insertDetail(id, detail);
						detail.setAll1(2, id, 45, true, "TROMBONE", "What is a skeleton's facorite instrument? A ___ .");
						insertDetail(id, detail);
						detail.setAll1(9, id, 54, false, "PUPIL", "Why did the cyclops quit teaching? He had only one ___ .");
						insertDetail(id, detail);
						detail.setAll1(3, id, 74, true, "SPOOK", "What did the mommy ghost say to the baby ghost? Don't ___ until you're spooken to.");
						insertDetail(id, detail);
						detail.setAll1(10, id, 85, false, "BLOOD", "How do vampires get around on Halloween night? With ___ vessels.");
						insertDetail(id, detail);
						detail.setAll1(4, id, 105, true, "BLOODHOUNDS", "What type of dog do campires like best?");
						insertDetail(id, detail);
						detail.setAll1(11, id, 129, false, "WRAP", "What kind of music do mummies listen to?");
						insertDetail(id, detail);
						detail.setAll1(5, id, 139, true, "SCARE", "What do witches put in their hair? ___ Spray.");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(14, 14, "Game7", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll1(7, id, 12, false, "SCREAM", "What does a ghost have for desert? I ___ .");
						insertDetail(id, detail);
						detail.setAll1(8, id, 24, false, "BLOOD", "How do vampires get around on Halloween night? With ___ vessels.");
						insertDetail(id, detail);
						detail.setAll1(9, id, 33, false, "BOO", "How does a ghost cry? ___ Hoo!");
						insertDetail(id, detail);
						detail.setAll1(1, id, 46, true, "TOMBSTONES", "What kind of rocks does Frankenstein have in his collection?");
						insertDetail(id, detail);
						detail.setAll1(10, id, 50, false, "SKELETON", "What kind of key should you always take to a haunted house?");
						insertDetail(id, detail);
						detail.setAll1(2, id, 88, true, "PUPIL", "Why did the cyclops quit teaching? He had only one ___ .");
						insertDetail(id, detail);
						detail.setAll1(11, id, 108, false, "HUNGRY", "What do you call a monster chasing a train full of people?");
						insertDetail(id, detail);
						detail.setAll1(3, id, 128, true, "BLOODHOUNDS", "What type of dog do vampires like best?");
						insertDetail(id, detail);
						detail.setAll1(12, id, 132, false, "DYING", "Why are there fences around cemeteries? Because people are ___ to get in.");
						insertDetail(id, detail);
						detail.setAll1(13, id, 138, false, "STAKE", "What does a vampire never order at a restaurant? A ___ Sandwich.");
						insertDetail(id, detail);
						detail.setAll1(4, id, 155, true, "PUMPKIN", "How did the ghost patch his sheet? With a ___ patch.");
						insertDetail(id, detail);
						detail.setAll1(5, id, 186, true, "DIG", "Who did the Zombie invite to his party? Anybody he could ___ up.");
						insertDetail(id, detail);
						detail.setAll1(6, id, 193, true, "NECK", "What's it like to be kissed by a vampire? It's a pain in the ___ .");
						insertDetail(id, detail);
					}

					//////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
					data = new clsWord();
					data.setAll(13, 13, "Game8", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll1(1, id, 1, true, "DANCE", "Trip the light fantastic.");
						insertDetail(id, detail);
						detail.setAll1(12, id, 2, false, "ACRES", "Farmer's measures.");
						insertDetail(id, detail);
						detail.setAll1(13, id, 3, false, "NEARS", "Approaches.");
						insertDetail(id, detail);
						detail.setAll1(14, id, 4, false, "CAN", "Corn container.");
						insertDetail(id, detail);
						detail.setAll1(15, id, 5, false, "ENDURE", "Stand the test of time.");
						insertDetail(id, detail);
						detail.setAll1(2, id, 7, true, "UPTO", "___ snuff (adequate).");
						insertDetail(id, detail);
						detail.setAll1(16, id, 8, false, "PLEA", "\"Not guilty,\" for one.");
						insertDetail(id, detail);
						detail.setAll1(17, id, 9, false, "TAR", "Material for a road or roof.");
						insertDetail(id, detail);
						detail.setAll1(18, id, 10, false, "OVATION", "It's music to a musician's ears.");
						insertDetail(id, detail);
						detail.setAll1(3, id, 27, true, "GRANDOPERA", "Lavish musical production.");
						insertDetail(id, detail);
						detail.setAll1(4, id, 44, true, "URSA", "Heavenly bear.");
						insertDetail(id, detail);
						detail.setAll1(5, id, 61, true, "PIPE", "Organ tube.");
						insertDetail(id, detail);
						detail.setAll1(19, id, 25, false, "ERIE", "Fifteen Miles on the ___ Canal.");
						insertDetail(id, detail);
						detail.setAll1(6, id, 53, true, "ASSURE", "Guarantee.");
						insertDetail(id, detail);
						detail.setAll1(7, id, 73, true, "HMONG", "Some Vietnamese.");
						insertDetail(id, detail);
						detail.setAll1(8, id, 157, true, "ERRS", "Messes up.");
						insertDetail(id, detail);
						detail.setAll1(20, id, 119, false, "AVER", "Declare.");
						insertDetail(id, detail);
						detail.setAll1(9, id, 92, true, "OVER", "Oz, in relation to the rainbow.");
						insertDetail(id, detail);
						detail.setAll1(10, id, 118, true, "SAHARA", "North African expanse.");
						insertDetail(id, detail);
						detail.setAll1(21, id, 115, false, "ECOLI", "Researcher's bacteria.");
						insertDetail(id, detail);
						detail.setAll1(11, id, 133, true, "GREENONION", "Scallion.");
						insertDetail(id, detail);
						detail.setAll1(22, id, 112, false, "CLOY", "Sicken with sweetness.");
						insertDetail(id, detail);
						detail.setAll1(23, id, 79, false, "NOW", "When impatient people want it.");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(14, 14, "Game9", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll1(9, id, 1, false, "RETINA", "Light sensitive lining of the inner eyeball?");
						insertDetail(id, detail);
						detail.setAll1(10, id, 4, false, "MARATHON", "The longest running race in the Olympic games?");
						insertDetail(id, detail);
						detail.setAll1(11, id, 9, false, "SOUTHAFRICA", "Worlds largest diamond producing country?");
						insertDetail(id, detail);
						detail.setAll1(12, id, 13, false, "ARYABHATA", "Father of Hindu Arabic number system?");
						insertDetail(id, detail);
						detail.setAll1(1, id, 21, true, "LION", "King of the jungle?");
						insertDetail(id, detail);
						detail.setAll1(2, id, 32, true, "RED", "Color that has maximum wave length?");
						insertDetail(id, detail);
						detail.setAll1(3, id, 53, true, "COAL", "Black diamond is an alternative name of?");
						insertDetail(id, detail);
						detail.setAll1(4, id, 71, true, "ANDHRAPRADESH", "Rice bowl of India?");
						insertDetail(id, detail);
						detail.setAll1(13, id, 104, false, "GRAVITY", "Force of attraction between two masses?");
						insertDetail(id, detail);
						detail.setAll1(5, id, 109, true, "BYTE", "Group of eight binary digits?");
						insertDetail(id, detail);
						detail.setAll1(6, id, 129, true, "TITANIC", "Hardes bone in human body?");
						insertDetail(id, detail);
						detail.setAll1(14, id, 153, false, "ZINC", "Zn is the chemical symbol of?");
						insertDetail(id, detail);
						detail.setAll1(7, id, 159, true, "SIX", "How many legs does a butterfly have?");
						insertDetail(id, detail);
						detail.setAll1(8, id, 176, true, "OXYGEN", "Water is composed of hydrogen and?");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(14, 14, "Game10", "Other");
					id = (int) insertGame(data);
					Log.i(tag, "insertDataTest() id: " + id);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll1(9, id, 9, false, "ISAACNEWTON", "He proposed laws of gravity?");
						insertDetail(id, detail);
						detail.setAll1(10, id, 14, false, "TORTOISE", "Animal with longest life span?");
						insertDetail(id, detail);
						detail.setAll1(11, id, 18, false, "SIX", "How many legs does a butterfly have?");
						insertDetail(id, detail);
						detail.setAll1(12, id, 21, false, "GREENLAND", "Biggest Island of the world?");
						insertDetail(id, detail);
						detail.setAll1(13, id, 26, false, "JAMESBON", "In movies 007 is the mark of?");
						insertDetail(id, detail);
						detail.setAll1(1, id, 30, true, "JAIPUR", "Pink city of India?");
						insertDetail(id, detail);
						detail.setAll1(14, id, 43, false, "PACIFIC", "The largest ocean in the world?");
						insertDetail(id, detail);
						detail.setAll1(2, id, 61, true, "GREECE", "First Olympic Games held the country?");
						insertDetail(id, detail);
						detail.setAll1(3, id, 71, true, "CUBA", "Sugar bowl of the world?");
						insertDetail(id, detail);
						detail.setAll1(15, id, 74, false, "ARYABHATA", "Father of Hindu Arabic number system?");
						insertDetail(id, detail);
						detail.setAll1(4, id, 109, true, "ROSE", "National flower of Britain?");
						insertDetail(id, detail);
						detail.setAll1(5, id, 127, true, "CARBONDIOXIDE", "The gas use in seize fire?");
						insertDetail(id, detail);
						detail.setAll1(16, id, 139, false, "EGYPT", "Gift of Nile?");
						insertDetail(id, detail);
						detail.setAll1(6, id, 155, true, "OCTAGON", "Eight sided figure?");
						insertDetail(id, detail);
						detail.setAll1(7, id, 183, true, "BOTANY", "Study of plants?");
						insertDetail(id, detail);
						detail.setAll1(8, id, 190, true, "GRAVITY", "Force of attraction between two masses?");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(14, 14, "Game11", "Other");
					id = (int) insertGame(data);
					Log.i(tag, "insertDataTest() id: " + id);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll1(5, id, 3, false, "TETINA", "Light sensitive lining of the inner eyeball?");
						insertDetail(id, detail);
						detail.setAll1(6, id, 5, false, "ADVENT", "First interactive online game?");
						insertDetail(id, detail);
						detail.setAll1(7, id, 7, false, "THYROID", "A Gland located near the base of the neck?");
						insertDetail(id, detail);
						detail.setAll1(8, id, 9, false, "ISAACNEWTON", "He proposed laws of gravity?");
						insertDetail(id, detail);
						detail.setAll1(9, id, 27, false, "RIOMORRIE", "Miss Universe 2007.");
						insertDetail(id, detail);
						detail.setAll1(1, id, 40, true, "SIX", "How many legs does a butterfly have?");
						insertDetail(id, detail);
						detail.setAll1(10, id, 67, false, "BYTE", "Group of eight binary digits?");
						insertDetail(id, detail);
						detail.setAll1(2, id, 72, true, "WALTDISNEY", "Creater of Mickey Mouse character?");
						insertDetail(id, detail);
						detail.setAll1(11, id, 100, false, "PEACOCK", "National bird of India?");
						insertDetail(id, detail);
						detail.setAll1(12, id, 102, false, "CUBA", "Sugar bowl of the world?");
						insertDetail(id, detail);
						detail.setAll1(13, id, 104, false, "GANDHI", "Father of the nation (India)?");
						insertDetail(id, detail);
						detail.setAll1(3, id, 127, true, "CARBONDIOXIDE", "The gas use in seize fire?");
						insertDetail(id, detail);
						detail.setAll1(14, id, 137, false, "INDIA", "Second largest populated country?");
						insertDetail(id, detail);
						detail.setAll1(4, id, 176, true, "HELIUM", "Most difficult gas to liquefy?");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(14, 15, "Game3", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll(id, 1, true, 2, "ABACO", "An island in the bahamas");
						insertDetail(id, detail);
						detail.setAll(id, 2, false, 3, "BULL", "A male bovine animal");
						insertDetail(id, detail);
						detail.setAll(id, 3, false, 5, "CIRCUS", "A traveling talent show bizarre");
						insertDetail(id, detail);
						detail.setAll(id, 4, true, 35, "READ", "Between the lines");
						insertDetail(id, detail);
						detail.setAll(id, 5, true, 80, "SHERLOCK", "holmes");
						insertDetail(id, detail);
						detail.setAll(id, 6, true, 8, "TARO", "Tropical starchy herb of the pacific");
						insertDetail(id, detail);
						detail.setAll(id, 6, false, 8, "THD", "Doctor of theology");
						insertDetail(id, detail);
						detail.setAll(id, 7, true, 13, "JUT", "Projecting");
						insertDetail(id, detail);
						detail.setAll(id, 7, false, 14, "UNDER", "beneath");
						insertDetail(id, detail);
						detail.setAll(id, 8, true, 31, "DAL", "An indian dish of spiced legumes");
						insertDetail(id, detail);
						detail.setAll(id, 8, false, 31, "DUDS", "Clothing belongings");
						insertDetail(id, detail);
						detail.setAll(id, 10, true, 41, "HEAD", "The front or top like on you");
						insertDetail(id, detail);
						detail.setAll(id, 9, false, 41, "HITCH", "Device for towing vehicles");
						insertDetail(id, detail);
						detail.setAll(id, 10, true, 110, "ASTHMA", "Common respiratory disease");
						insertDetail(id, detail);
						detail.setAll(id, 10, false, 110, "ASEA", "To or toward the sea");
						insertDetail(id, detail);
						detail.setAll(id, 11, true, 139, "WED", "Day of the week");
						insertDetail(id, detail);
						detail.setAll(id, 12, true, 76, "SCI", "of science");
						insertDetail(id, detail);
						detail.setAll(id, 13, true, 175, "WAW", "Hebrew letter also vav");
						insertDetail(id, detail);
						detail.setAll(id, 14, true, 121, "DIP", "A small depression of a coating");
						insertDetail(id, detail);
						detail.setAll(id, 14, false, 121, "DEAN", "The head of a colege");
						insertDetail(id, detail);
						detail.setAll(id, 15, true, 166, "NYC", "City that never sleeps");
						insertDetail(id, detail);
						detail.setAll(id, 17, true, 103, "PIG", "Dirt gluttonous animal");
						insertDetail(id, detail);
						detail.setAll(id, 16, false, 103, "POURS", "When it rains it");
						insertDetail(id, detail);
						detail.setAll(id, 17, true, 73, "YRS", "Short of years");
						insertDetail(id, detail);
						detail.setAll(id, 17, false, 84, "LIMIT", "The sky is the");
						insertDetail(id, detail);
						detail.setAll(id, 18, true, 144, "TIGER", "Large powerful cat");
						insertDetail(id, detail);
						detail.setAll(id, 21, false, 78, "INSP", "refers to inspector");
						insertDetail(id, detail);
						detail.setAll(id, 19, false, 146, "GOA", "State of sw india also a gazelle");
						insertDetail(id, detail);
						detail.setAll(id, 20, false, 168, "COP", "enforces the law");
						insertDetail(id, detail);
						detail.setAll(id, 21, false, 105, "GAIT", "A manner of walking");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(13, 13, "Game13", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll(id, 1, true, 1, "LISA", "Mona ___");
						insertDetail(id, detail);
						detail.setAll(id, 1, false, 1, "LOB", "TOSS");
						insertDetail(id, detail);
						detail.setAll(id, 2, false, 2, "IDO", "Altar vow (2 wds.)");
						insertDetail(id, detail);
						detail.setAll(id, 3, false, 3, "SEA", "Briny deep");
						insertDetail(id, detail);
						detail.setAll(id, 4, false, 4, "ASTAIRE", "Dancer Fred ___");
						insertDetail(id, detail);
						detail.setAll(id, 5, true, 6, "DECO", "Art ___");
						insertDetail(id, detail);
						detail.setAll(id, 5, false, 6, "DEMI", "___ Moore of [Indecent Proposal]");
						insertDetail(id, detail);
						detail.setAll(id, 6, false, 7, "EVADER", "Dodger");
						insertDetail(id, detail);
						detail.setAll(id, 7, false, 8, "CINEMAS", "Movie theaters");
						insertDetail(id, detail);
						detail.setAll(id, 8, false, 9, "OLD", "Elderly");
						insertDetail(id, detail);
						detail.setAll(id, 9, true, 11, "PAL", "Comrade");
						insertDetail(id, detail);
						detail.setAll(id, 9, false, 11, "PARIS", "France's capital");
						insertDetail(id, detail);
						detail.setAll(id, 10, false, 12, "AMINO", "___ acid");
						insertDetail(id, detail);
						detail.setAll(id, 11, false, 13, "LINEN", "Fine fabric");
						insertDetail(id, detail);
						detail.setAll(id, 12, true, 14, "ODES", "Keats poems");
						insertDetail(id, detail);
						detail.setAll(id, 13, true, 19, "EVIL", "Satan's specialty");
						insertDetail(id, detail);
						detail.setAll(id, 14, true, 24, "AMI", "Buddy (Fr.)");
						insertDetail(id, detail);
						detail.setAll(id, 15, true, 27, "BOAT", "Water vehicle");
						insertDetail(id, detail);
						detail.setAll(id, 16, true, 32, "MANDARIN", "Chinese languge");
						insertDetail(id, detail);
						detail.setAll(id, 17, false, 36, "APR", "Spring mo.");
						insertDetail(id, detail);
						detail.setAll(id, 18, true, 43, "ABIDE", "Dwell");
						insertDetail(id, detail);
						detail.setAll(id, 19, false, 44, "BONSAI", "Dwarfed shrub");
						insertDetail(id, detail);
						detail.setAll(id, 20, true, 49, "PINE", "Yeam");
						insertDetail(id, detail);
						detail.setAll(id, 21, true, 53, "RADIO", "Car accessory");
						insertDetail(id, detail);
						detail.setAll(id, 21, false, 53, "RAH", "cheerleader's shout");
						insertDetail(id, detail);
						detail.setAll(id, 22, false, 54, "ADO", "Bustle");
						insertDetail(id, detail);
						detail.setAll(id, 23, false, 55, "DON", "___ Quixote");
						insertDetail(id, detail);
						detail.setAll(id, 24, true, 59, "EMERSON", "Ralph Waldo ____");
						insertDetail(id, detail);
						detail.setAll(id, 25, false, 61, "ENAMEL", "Glossy paint");
						insertDetail(id, detail);
						detail.setAll(id, 26, true, 66, "ADORN", "Embellish");
						insertDetail(id, detail);
						detail.setAll(id, 27, true, 72, "RAN", "Rushed");
						insertDetail(id, detail);
						detail.setAll(id, 28, true, 79, "HONEST", "Truthful");
						insertDetail(id, detail);
						detail.setAll(id, 29, false, 84, "TRAINER", "Coach");
						insertDetail(id, detail);
						detail.setAll(id, 30, true, 86, "SACRED", "Holy");
						insertDetail(id, detail);
						detail.setAll(id, 31, false, 88, "COASTAL", "Of the seashore");
						insertDetail(id, detail);
						detail.setAll(id, 32, false, 89, "ROT", "Deteriorate");
						insertDetail(id, detail);
						detail.setAll(id, 33, false, 90, "ESE", "Wind dir.");
						insertDetail(id, detail);
						detail.setAll(id, 34, false, 91, "DEN", "Lion's lair");
						insertDetail(id, detail);
						detail.setAll(id, 35, true, 96, "ARE", "Exist");
						insertDetail(id, detail);
						detail.setAll(id, 36, false, 98, "ENDEAR", "Make lovable");
						insertDetail(id, detail);
						detail.setAll(id, 37, true, 100, "MOOSE", "Bullwinkle, for one");
						insertDetail(id, detail);
						detail.setAll(id, 38, true, 105, "ARAB", "Horse breed");
						insertDetail(id, detail);
						detail.setAll(id, 38, false, 105, "ALIEN", "Foreigner");
						insertDetail(id, detail);
						detail.setAll(id, 39, false, 106, "ROMEO", "Juliet's beloved");
						insertDetail(id, detail);
						detail.setAll(id, 40, false, 107, "APART", "Into pieces");
						insertDetail(id, detail);
						detail.setAll(id, 41, false, 108, "BEG", "Ask for alms");
						insertDetail(id, detail);
						detail.setAll(id, 42, true, 113, "EATEN", "Dined");
						insertDetail(id, detail);
						detail.setAll(id, 43, true, 118, "LOPE", "Canter");
						insertDetail(id, detail);
						detail.setAll(id, 44, true, 123, "IDOLS", "Pagan gods");
						insertDetail(id, detail);
						detail.setAll(id, 45, false, 125, "ODDS", "Probabilities");
						insertDetail(id, detail);
						detail.setAll(id, 46, true, 131, "IMAGINED", "Supposed");
						insertDetail(id, detail);
						detail.setAll(id, 47, false, 135, "IRE", "Intense rage");
						insertDetail(id, detail);
						detail.setAll(id, 48, true, 140, "TREE", "Family diagram");
						insertDetail(id, detail);
						detail.setAll(id, 49, false, 141, "RBI", "Baseball stat");
						insertDetail(id, detail);
						detail.setAll(id, 50, false, 142, "ELF", "Brownie");
						insertDetail(id, detail);
						detail.setAll(id, 51, false, 143, "EYE", "Needle hole");
						insertDetail(id, detail);
						detail.setAll(id, 52, true, 144, "EER", "Poet's always");
						insertDetail(id, detail);
						detail.setAll(id, 53, true, 148, "READ", "Enjoy a book");
						insertDetail(id, detail);
						detail.setAll(id, 54, true, 153, "ABLY", "With competence");
						insertDetail(id, detail);
						detail.setAll(id, 55, true, 157, "NOT", "___ guilty");
						insertDetail(id, detail);
						detail.setAll(id, 56, true, 161, "ERRS", "Miscalculates");
						insertDetail(id, detail);
						detail.setAll(id, 57, true, 166, "LIFE", "Existence");
						insertDetail(id, detail);
					}

					// http://www.abcteach.com/directory/fun_activities/crossword_puzzles/
					data = new clsWord();
					data.setAll(9, 14, "Plants", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll(id, 1, true, 1, "PHOTOSYNTHESIS", "Plants make their food with this process.");
						insertDetail(id, detail);
						detail.setAll(id, 1, false, 1, "PLANT", "A kind of kingdom.");
						insertDetail(id, detail);
						detail.setAll(id, 2, false, 6, "SEED", "Holds the beginning of a new plant.");
						insertDetail(id, detail);
						detail.setAll(id, 3, true, 32, "STEM", "A 'transport system'.");
						insertDetail(id, detail);
						detail.setAll(id, 3, false, 32, "SUGARS", "Product of photosynthesis (along with oxygen).");
						insertDetail(id, detail);
						detail.setAll(id, 4, false, 42, "OXYGEN", "Plants produce this.");
						insertDetail(id, detail);
						detail.setAll(id, 5, false, 63, "SUN", "Source of energy.");
						insertDetail(id, detail);
						detail.setAll(id, 6, false, 66, "ROOTS", "Used by many plants to take in water and minerals.");
						insertDetail(id, detail);
						detail.setAll(id, 7, true, 86, "CARBONDIOXIDE", "Plants need this gas for photosynthesis.");
						insertDetail(id, detail);
						detail.setAll(id, 8, true, 117, "LEAVES", "Where most plants make their food.");
						insertDetail(id, detail);
					}

					data = new clsWord();
					data.setAll(12, 13, "Thanksgiving Today", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll(id, 1, false, 4, "OVEN", "It would be hard to cook a turkey without one of these.");
						insertDetail(id, detail);
						detail.setAll(id, 2, false, 10, "CRANBERRY", "Most popular berry at Thanksgiving dinner.");
						insertDetail(id, detail);
						detail.setAll(id, 3, true, 21, "TURKEY", "Star of the Thanksgiving dinner.");
						insertDetail(id, detail);
						detail.setAll(id, 4, false, 27, "TRADITION", "Thanksgiving dinner is a popular, and old, American ___.");
						insertDetail(id, detail);
						detail.setAll(id, 5, false, 32, "FOOTBALL", "Game often watched on television after Thanksgiving dinner.");
						insertDetail(id, detail);
						detail.setAll(id, 6, true, 40, "REUNION", "Thanksgiving is often an occasion for a family ___.");
						insertDetail(id, detail);
						detail.setAll(id, 7, false, 60, "STUFFING", "Thanksgiving turkeys are usually full of this.");
						insertDetail(id, detail);
						detail.setAll(id, 8, true, 69, "POTATOES", "Mashed ___.");
						insertDetail(id, detail);
						detail.setAll(id, 8, false, 69, "PUMPKIN", "Popular Thanksgiving dessert: ___ pie.");
						insertDetail(id, detail);
						detail.setAll(id, 9, false, 90, "FAMILY", "Most people celebrate Thanksgiving with their _____.");
						insertDetail(id, detail);
						detail.setAll(id, 10, true, 114, "YAM", "Popular root for Thanksgiving dinner.");
						insertDetail(id, detail);
						detail.setAll(id, 11, true, 151, "GRAVY", "Popular sauce.");
						insertDetail(id, detail);
					}

					///////////////////////
					data = new clsWord();
					data.setAll(10, 13, "Castles", "Other");
					id = (int) insertGame(data);
					if (id >= 0) {
						detail = new clsWordDetail();
						detail.setAll(id, 1, false, 5, "DRAWBRIDGE", "A bridge that can be raised");
						insertDetail(id, detail);
						detail.setAll(id, 2, false, 8, "MOAT", "Water under the drawbridge");
						insertDetail(id, detail);
						detail.setAll(id, 3, false, 26, "HAWKHOUSE", "Where hunting birds are kept");
						insertDetail(id, detail);
						detail.setAll(id, 4, true, 28, "GREATHALL", "A giant dining room");
						insertDetail(id, detail);
						detail.setAll(id, 5, true, 67, "COURTYARD", "Within the castle walls, but outside");
						insertDetail(id, detail);
						detail.setAll(id, 6, true, 96, "DUNGEON", "Where prisoners are kept");
						insertDetail(id, detail);
						detail.setAll(id, 7, true, 118, "SECRETPASSAGE", "A passageway between rooms");
						insertDetail(id, detail);
					}

				}
				cur.close();

			}
		} catch (Exception ex) {
			if (cur != null && !cur.isClosed()) {
				cur.close();
			}
			Log.i(tag + "insertDataTest", "Error: " + ex.getMessage());
		}
	}

}
